<!DOCTYPE html>
<html lang="en" class="no-js" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="layout">
<head>
<title>配送方式管理</title>
</head>
<body>
<div layout:fragment="content">
	<div class="row">
		<div class="col-md-12">
			<div class="btn-group pull-right">
				<a href="index.html" th:href="@{/system/deliver/index/}" id="link_return" class="btn green">返回<i class="fa fa-arrow-circle-o-left"></i></a>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-md-12">
			<div class="form">
				<form role="form" id="form_deliver_edit"  th:action="@{/system/deliver/save}" th:object="${deliver}" method="post" class="form-horizontal">
                    <input type="hidden" th:field="*{deliverAreas}"/>
                    <input type="hidden" th:field="*{id}" />
					<h4 class="form-section">配送方式信息</h4>
					<div class="form-body">
						<div class="form-group" th:class="${#fields.hasErrors('name')}? 'form-group has-error' : 'form-group'">
							<label class="control-label col-md-3">配送方式名称<span class="required" aria-required="true">* </span></label>
							<div class="col-md-4">
								<input type="text" id="text_name" class="form-control" placeholder="配送区域名称" th:field="*{name}" required=""/>
								<span class="help-block" th:if="${#fields.hasErrors('name')}" th:errors="*{name}"></span>
							</div>
						</div>
                        <div class="form-group" th:class="${#fields.hasErrors('description')}? 'form-group has-error' : 'form-group'">
                            <label class="control-label col-md-3">配送方式描述<span class="required" aria-required="true">*</span></label>
                            <div class="col-md-4">
                                <textarea id="textarea_description" cols="10" rows="5" class="form-control" placeholder="配送区域描述" th:field="*{description}"></textarea>
                                <span class="help-block" th:if="${#fields.hasErrors('description')}" th:errors="*{description}"></span>
                            </div>
                        </div>
                        <div class="form-group" th:class="${#fields.hasErrors('deliverTypeList')}? 'form-group has-error' : 'form-group'">
                            <label class="control-label col-md-3">支持支付方式<span class="required" aria-required="true">* </span></label>
                            <div class="col-md-4">
                                <div class="checkbox-list" >
                                    <label class="checkbox-inline" th:each="type : ${typeList}"><span><input type="checkbox" th:attr="id=${'checkbox_type_'+typeStat.index}" name="checkbox_type" th:field="*{deliverTypeList}" th:text="${type.description}" th:value="${type}"/></span></label>
                                </div>
                                <span class="help-block" th:if="${#fields.hasErrors('deliverTypeList')}" th:errors="*{deliverTypeList}"></span>
                            </div>
                        </div>
                        <div class="form-group">
							<label class="control-label col-md-3">是否显示<span class="required" aria-required="true">*</span></label>
							<div class="col-md-4">
								<div class="radio-list">
									<label class="radio-inline"><span><input id="radio_displayed_1" type="radio" value="1" checked="" th:field="*{displayed}" /></span> 是</label>
									<label class="radio-inline"><span><input id="radio_displayed_2" type="radio" value="0" th:field="*{displayed}" /></span> 否</label>
								</div>
							</div>
						</div>
					</div>
					<div class="form-actions fluid">
						<div class="col-md-offset-3 col-md-9">
							<button type="submit" id="bt_submit" class="btn blue">提交</button>
						</div>
					</div>
				</form>		
			</div>
		</div>
	</div>
</div>	
</body>
</html>

<script th:inline="javascript">
    /*<![CDATA[*/
    $(document).ready(function(){
        $("#form_deliver_edit").validate({
            rules:{
                name:{
                    required:true,
                    maxlength:100
                },
                description: {
                    required: true,
                    maxlength: 254
                }
            },
            messages:{
                name:{
                    required:"请输入配送方式名称",
                    maxlength:"最大不能超过100个字符"
                },
                description: {
                    required: "请输入配送方式描述",
                    maxlength: "最大不能超过255个字符"
                }
            }
        });
    });

    /*]]>*/
</script>